CC=g++
MAINFLAGS=-c -g -Wall
CFLAGS=$(MAINFLAGS) -shared
LINKERFLAGS=-shared
LDFLAGS=-L. -lsymce
SOURCES=Diff.cpp Fraction.cpp Multitree.cpp Reduce.cpp Tuplets.cpp Expression.cpp Integers.cpp Number.cpp Symbol.cpp Expand.cpp Numeric.cpp Taylor.cpp 
OBJECTS=$(SOURCES:.cpp=.o)
LIBRARY=libsymce.so
EXECUTABLE=symce
DEPEND=makedepend
MAINC=main.cpp
MAINO=$(MAINC:.cpp=.o)

all: $(SOURCES) $(EXECUTABLE)
	echo "Do not forget setting LD_LIBRARY_PATH to . before running your program."

static: $(OBJECTS) $(MAINO)
	$(CC) $(OBJECTS) $(MAINO) -o $(EXECUTABLE)-static
	
depend: $(SOURCES)
	$(DEPEND) $(SOURCES)

$(EXECUTABLE): $(LIBRARY) $(MAINO)
	$(CC) $(LDFLAGS) $(MAINO) -o $@

$(LIBRARY): $(OBJECTS)
	$(CC) $(LINKERFLAGS) $(OBJECTS) -o $@

$(MAINO): $(MAINC)
	$(CC) $(MAINFLAGS) $(MAINC) -o $(MAINO)
.cpp.o:
	$(CC) $(CFLAGS) $< -o $@

clean:
	-rm $(OBJECTS) $(EXECUTABLE) $(MAINO) $(LIBRARY) $(EXECUTABLE)-static

# DO NOT DELETE
